-- 请确保oracle中已经创建了youyaboot数据库  把以下sql语句批量执行
-- create database youyaboot; use youyaboot; 注意大小写
-- DROP TABLE  DICT ;
CREATE TABLE DICT
(
    ID NUMBER(18) DEFAULT NULL PRIMARY KEY NOT NULL,
    DICT_CATEGORY VARCHAR2(50) NOT NULL,
    CODE VARCHAR2(50) DEFAULT ''  NOT NULL,
    NAME VARCHAR2(300) DEFAULT ''  NOT NULL,
    DICT_DESCRIPTION CLOB,
    PARENT_ID NUMBER(18) DEFAULT NULL,
    CREATE_TIME DATE NOT NULL,
    UPDATE_TIME DATE NOT NULL,
    ORDER_NO NUMBER(3) DEFAULT '0'
);
COMMENT ON COLUMN DICT.ID IS '主键';
COMMENT ON COLUMN DICT.DICT_CATEGORY IS '大类';
COMMENT ON COLUMN DICT.CODE IS '键';
COMMENT ON COLUMN DICT.NAME IS '值';
COMMENT ON COLUMN DICT.DICT_DESCRIPTION IS '描述';
COMMENT ON COLUMN DICT.PARENT_ID IS '父子关系';
COMMENT ON COLUMN DICT.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN DICT.UPDATE_TIME IS '更新时间';
COMMENT ON COLUMN DICT.ORDER_NO IS '编码';

-- DROP TABLE  SYS_ADMIN_USER ;
CREATE TABLE SYS_ADMIN_USER
(
    ID NUMBER(18) PRIMARY KEY NOT NULL,
    USERNAME VARCHAR2(20) DEFAULT '',
    PASSWORD VARCHAR2(50) DEFAULT '',
    REAL_NAME VARCHAR2(25) DEFAULT '',
    EMAIL VARCHAR2(30) DEFAULT '',
    TELEPHONE VARCHAR2(20) DEFAULT '',
    MOBILE_PHONE VARCHAR2(20) DEFAULT '',
    ADDRESS VARCHAR2(100) DEFAULT '',
    CREATE_TIME DATE DEFAULT NULL,
    UPDATE_TIME DATE DEFAULT NULL,
    ROLE_ID NUMBER(18) DEFAULT '0',
    ACCOUNT_NON_EXPIRED NUMBER(1) DEFAULT '0',
    ACCOUNT_NON_LOCKED NUMBER(1) DEFAULT '0',
    CREDENTIALS_NON_EXPIRED NUMBER(1) DEFAULT NULL,
    ENABLED NUMBER(1) DEFAULT NULL

);
INSERT INTO SYS_ADMIN_USER (ID, USERNAME, PASSWORD, REAL_NAME, EMAIL, TELEPHONE, MOBILE_PHONE, ADDRESS, CREATE_TIME, UPDATE_TIME, ROLE_ID, ACCOUNT_NON_EXPIRED, ACCOUNT_NON_LOCKED, CREDENTIALS_NON_EXPIRED, ENABLED) VALUES (3, 'admin', '21232f297a57a5a743894a0e4a801fc3', '管理员', null, null, null, null, TO_DATE('2018-07-30 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), TO_DATE('2018-07-30 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 1, 0, 0, 0, 1);
INSERT INTO SYS_ADMIN_USER (ID, USERNAME, PASSWORD, REAL_NAME, EMAIL, TELEPHONE, MOBILE_PHONE, ADDRESS, CREATE_TIME, UPDATE_TIME, ROLE_ID, ACCOUNT_NON_EXPIRED, ACCOUNT_NON_LOCKED, CREDENTIALS_NON_EXPIRED, ENABLED) VALUES (4, 'test', '098f6bcd4621d373cade4e832627b4f6', '测试人员', null, null, null, null, TO_DATE('2018-07-30 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), TO_DATE('2018-07-30 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 2, 0, 0, 0, 1);
INSERT INTO SYS_ADMIN_USER (ID, USERNAME, PASSWORD, REAL_NAME, EMAIL, TELEPHONE, MOBILE_PHONE, ADDRESS, CREATE_TIME, UPDATE_TIME, ROLE_ID, ACCOUNT_NON_EXPIRED, ACCOUNT_NON_LOCKED, CREDENTIALS_NON_EXPIRED, ENABLED) VALUES (7, 'magicalcoder', '6860c37b00ed4e444a7d2c6e8fb66886', '默认超级管理员', null, null, null, null, TO_DATE('2018-07-30 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), TO_DATE('2018-07-30 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 1, 0, 0, 0, 1);

-- DROP TABLE SYS_GLOBAL_PERMIT_URL;
CREATE TABLE SYS_GLOBAL_PERMIT_URL
(
    ID NUMBER(18) PRIMARY KEY NOT NULL,
    PERMIT_NAME VARCHAR2(200) DEFAULT '',
    BACKEND_URL_REG VARCHAR2(500) DEFAULT '',
    MODULE_ID NUMBER(18) DEFAULT NULL

);
INSERT INTO SYS_GLOBAL_PERMIT_URL (ID, PERMIT_NAME, BACKEND_URL_REG, MODULE_ID) VALUES (2, '允许进入后台,使用有些通用接口（请勿删除）', '/admin/(rmp|page|page_v2|common_file_rest).*', null);
INSERT INTO SYS_GLOBAL_PERMIT_URL (ID, PERMIT_NAME, BACKEND_URL_REG, MODULE_ID) VALUES (3, '通用获取权限相关接口（请勿删除）', '/admin/rest_rmp/(get_permission_list|get_module_list|user_info).*', null);

-- DROP TABLE SYS_LOG_ADMIN_OPERATE;
CREATE TABLE SYS_LOG_ADMIN_OPERATE
(
    ID NUMBER(18) PRIMARY KEY NOT NULL,
    ADMIN_USER_ID NUMBER(18) DEFAULT '0',
    USER_NAME VARCHAR2(200) DEFAULT '0',
    TABLE_NAME VARCHAR2(100) DEFAULT '',
    OPERATE_TYPE VARCHAR2(50) DEFAULT '',
    URL VARCHAR2(100) DEFAULT '',
    PRIMARY_ID_VALUE VARCHAR2(100) DEFAULT '',
    FORM_BODY CLOB,
    CREATE_TIME DATE DEFAULT NULL

);
-- DROP TABLE SYS_MODULE;
CREATE TABLE SYS_MODULE
(
    ID NUMBER(18) PRIMARY KEY NOT NULL,
    MODULE_NAME VARCHAR2(200) DEFAULT '',
    MODULE_URL VARCHAR2(200) DEFAULT '',
    MODULE_CATEGORY_ID NUMBER(18) DEFAULT '0',
    SORT_NUM NUMBER(2) DEFAULT '0',
    MODULE_TITLE VARCHAR2(50) DEFAULT '',
    IF_SHOW NUMBER(1) DEFAULT 1

);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (1, 'goods', 'admin/page_v2/goods/list', 1, 1, '商品管理', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (2, 'goods_category', 'admin/page_v2/goods_category/list', 1, 2, '商品类别', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (4, 'sys_log_admin_operate', 'admin/page_v2/sys_log_admin_operate/list', 3, 7, '系统日志', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (5, 'sys_module_category', 'admin/page_v2/sys_module_category/list', 3, 1, '菜单管理', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (7, 'sys_admin_user', 'admin/page_v2/sys_admin_user/list', 3, 3, '管理员', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (8, 'sys_global_permit_url', 'admin/page_v2/sys_global_permit_url/list', 3, 6, '全局地址过滤', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (11, 'sys_role', 'admin/page_v2/sys_role/list', 3, 2, '角色管理', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (17, 'sys', null, 3, -1, '系统表权限载体（请勿删除）', 0);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (18, 'goods_img', 'admin/page_v2/goods_img/list', 1, 4, '商品图集', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (19, 'goods_file', 'admin/page_v2/goods_file/list', 1, 5, '商品附件', 1);
INSERT INTO SYS_MODULE (ID, MODULE_NAME, MODULE_URL, MODULE_CATEGORY_ID, SORT_NUM, MODULE_TITLE, IF_SHOW) VALUES (20, 'dict', 'admin/page_v2/dict/list', 3, 10, '字典配置', 1);

-- DROP TABLE SYS_MODULE_CATEGORY;
CREATE TABLE SYS_MODULE_CATEGORY
(
    ID NUMBER(18) PRIMARY KEY NOT NULL,
    MODULE_CATEGORY_NAME VARCHAR2(20) DEFAULT '',
    SORT_NUM NUMBER(2) DEFAULT '0'

);
INSERT INTO SYS_MODULE_CATEGORY (ID, MODULE_CATEGORY_NAME, SORT_NUM) VALUES (1, '商品模块', 1);
INSERT INTO SYS_MODULE_CATEGORY (ID, MODULE_CATEGORY_NAME, SORT_NUM) VALUES (3, '系统模块', 2);

-- DROP TABLE SYS_PERMISSION;
CREATE TABLE SYS_PERMISSION
(
    ID NUMBER(18) PRIMARY KEY NOT NULL,
    PERMISSION_NAME VARCHAR2(50) DEFAULT '',
    FILTER_PLATFORM VARCHAR2(50) DEFAULT '',
    BACKEND_URL_REG VARCHAR2(200) DEFAULT '',
    FRONT_DOM VARCHAR2(1024) DEFAULT '',
    FRONT_ACTION VARCHAR2(50) DEFAULT '',
    MODULE_ID NUMBER(18) DEFAULT NULL

);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (2, '查询权限', 'backend', '/admin/goods_category_rest/.*', null, null, 2);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (13, '全类型测试', 'backend', '/admin/all_type_rest/.*', null, null, 14);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (15, '商品模块保存权限', 'front_backend', '/admin/goods_rest/(update|save).*', '.security_edit_form_operate_save', 'show', 1);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (17, '商品模块添加按钮', 'front', null, '.security_list_query_operate_add_news', 'show', 1);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (18, '商品模块(批量)删除权限', 'front_backend', '/admin/goods_rest/(delete|batch_delete).*', '.security_list_table_operate_del,.security_list_query_operate_del_all', 'show', 1);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (19, '商品模块查询权限', 'backend', '/admin/goods_rest/(search|page|get).*', null, null, 1);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (21, '所有系统表的所有权限(请勿删除)', 'backend', '/admin/(rest_rmp|sys_[a-z_]+_rest)/.*', null, 'show', 17);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (22, '测试商品模块disabled', 'front', null, '.security_edit_form_param_goodsName,.security_edit_form_param_imgSrc,.security_edit_form_param_publishStatus,.security_edit_form_param_goodsStatus,.security_edit_form_param_price,.security_edit_form_param_shortBrief,.security_edit_form_param_goodsDescription,.security_edit_form_param_createTime,.security_edit_form_param_goodsCategoryId', 'show', 1);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (23, '商品图集全部权限', 'front_backend', '/admin/goods_img_rest/.*', null, 'show', 18);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (24, '商品附件全部权限', 'front_backend', '/admin/goods_file_rest/.*', null, 'show', 19);
INSERT INTO SYS_PERMISSION (ID, PERMISSION_NAME, FILTER_PLATFORM, BACKEND_URL_REG, FRONT_DOM, FRONT_ACTION, MODULE_ID) VALUES (25, '字典全部权限', 'front_backend', '/admin/dict_rest/.*', null, 'show', 20);

-- DROP TABLE SYS_ROLE;
CREATE TABLE SYS_ROLE
(
    ID NUMBER(18) PRIMARY KEY NOT NULL,
    ROLE_NAME VARCHAR2(20) DEFAULT ''

);
INSERT INTO SYS_ROLE (ID, ROLE_NAME) VALUES (1, '超级管理员');
INSERT INTO SYS_ROLE (ID, ROLE_NAME) VALUES (2, '测试账号');

-- DROP TABLE SYS_ROLE_MODULE_PERMISSION;
CREATE TABLE SYS_ROLE_MODULE_PERMISSION
(
    ID NUMBER(18) DEFAULT NULL  PRIMARY KEY NOT NULL,
    ROLE_ID NUMBER(18) DEFAULT NULL ,
    MODULE_ID NUMBER(18) DEFAULT NULL ,
    PERMISSION_ID NUMBER(18) DEFAULT NULL

);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (426, 2, 1, 15);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (427, 2, 1, 17);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (428, 2, 1, 18);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (429, 2, 1, 19);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (430, 2, 1, 22);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (431, 2, 18, null);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (432, 2, 19, null);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1045, 1, 1, 15);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1046, 1, 1, 17);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1047, 1, 1, 18);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1048, 1, 1, 19);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1049, 1, 1, 22);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1050, 1, 2, 2);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1051, 1, 4, null);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1052, 1, 5, null);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1053, 1, 7, null);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1054, 1, 8, null);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1055, 1, 11, null);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1056, 1, 17, 21);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1057, 1, 18, 23);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1058, 1, 19, 24);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1059, 1, 20, 25);
INSERT INTO SYS_ROLE_MODULE_PERMISSION (ID, ROLE_ID, MODULE_ID, PERMISSION_ID) VALUES (1060, 1, 1000, 1001);

-- DROP TABLE GOODS;
CREATE TABLE GOODS
(
    ID NUMBER(18) DEFAULT NULL PRIMARY KEY NOT NULL,
    GOODS_NAME VARCHAR2(200) DEFAULT '' ,
    PUBLISH_STATUS NUMBER(1) DEFAULT 0,
    GOODS_STATUS NUMBER(2) DEFAULT 0 ,
    PRICE NUMBER(12,2) DEFAULT NULL ,
    STORE_COUNT NUMBER(4) DEFAULT 0 ,
    SHORT_BRIEF CLOB,
    GOODS_DESCRIPTION CLOB,
    CREATE_TIME DATE DEFAULT NULL,
    UPDATE_TIME DATE DEFAULT NULL,
    IMG_SRC VARCHAR2(200) DEFAULT '',
    GOODS_CATEGORY_ID NUMBER(18) DEFAULT NULL
);
COMMENT ON COLUMN GOODS.GOODS_NAME IS '商品名称';
COMMENT ON COLUMN GOODS.PUBLISH_STATUS IS '发布状态';
COMMENT ON COLUMN GOODS.GOODS_STATUS IS '商品状态
';
COMMENT ON COLUMN GOODS.PRICE IS '价格';
COMMENT ON COLUMN GOODS.STORE_COUNT IS '库存';
COMMENT ON COLUMN GOODS.SHORT_BRIEF IS '简介';
COMMENT ON COLUMN GOODS.GOODS_DESCRIPTION IS '描述';
COMMENT ON COLUMN GOODS.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN GOODS.UPDATE_TIME IS '更新时间';
COMMENT ON COLUMN GOODS.IMG_SRC IS '图片';
COMMENT ON COLUMN GOODS.GOODS_CATEGORY_ID IS '所属分类';
INSERT INTO GOODS (ID, GOODS_NAME, PUBLISH_STATUS, GOODS_STATUS, PRICE, STORE_COUNT, SHORT_BRIEF, GOODS_DESCRIPTION, CREATE_TIME, UPDATE_TIME, IMG_SRC, GOODS_CATEGORY_ID) VALUES (1000, '上衣', 1, 0, null, 0, null, null, TO_DATE('2018-09-26 08:47:16', 'YYYY-MM-DD HH24:MI:SS'), TO_DATE('2018-09-26 08:47:18', 'YYYY-MM-DD HH24:MI:SS'), 'upload/20180926084714_474414.jpg', 1003);
INSERT INTO GOODS (ID, GOODS_NAME, PUBLISH_STATUS, GOODS_STATUS, PRICE, STORE_COUNT, SHORT_BRIEF, GOODS_DESCRIPTION, CREATE_TIME, UPDATE_TIME, IMG_SRC, GOODS_CATEGORY_ID) VALUES (1001, '商品', 1, 0, 11.00, 1, '2', null, TO_DATE('2018-09-26 08:51:58', 'YYYY-MM-DD HH24:MI:SS'), TO_DATE('2018-09-26 08:52:00', 'YYYY-MM-DD HH24:MI:SS'), null, 1003);

-- DROP TABLE GOODS_CATEGORY;
CREATE TABLE GOODS_CATEGORY
(
    ID NUMBER(18) DEFAULT NULL PRIMARY KEY NOT NULL,
    NAME VARCHAR2(50) DEFAULT '' ,
    KEYWORD VARCHAR2(50) DEFAULT ''
);
COMMENT ON COLUMN GOODS_CATEGORY.ID IS '主键';
COMMENT ON COLUMN GOODS_CATEGORY.NAME IS '名称';
COMMENT ON COLUMN GOODS_CATEGORY.KEYWORD IS '关键词';
INSERT INTO GOODS_CATEGORY (ID, NAME, KEYWORD) VALUES (1003, '交通', 'jiaotong');
INSERT INTO GOODS_CATEGORY (ID, NAME, KEYWORD) VALUES (1002, '衣服', 'yifu');

-- DROP TABLE GOODS_FILE;
CREATE TABLE GOODS_FILE
(
    FILE_ID NUMBER(18) DEFAULT NULL PRIMARY KEY NOT NULL,
    FILE_SRC VARCHAR2(100) DEFAULT '' ,
    GOODS_ID NUMBER(18) DEFAULT NULL
);
COMMENT ON COLUMN GOODS_FILE.FILE_ID IS '主键';
COMMENT ON COLUMN GOODS_FILE.FILE_SRC IS '附件地址';
COMMENT ON COLUMN GOODS_FILE.GOODS_ID IS '所属商品';
INSERT INTO GOODS_FILE (FILE_ID, FILE_SRC, GOODS_ID) VALUES (1000, 'upload/20180926090807_181136.jpg', 1001);

-- DROP TABLE GOODS_IMG ;
CREATE TABLE GOODS_IMG
(
    IMG_ID NUMBER(18) DEFAULT NULL PRIMARY KEY NOT NULL,
    IMG_SRC VARCHAR2(100) DEFAULT '' ,
    GOODS_ID NUMBER(18) DEFAULT NULL
);
COMMENT ON COLUMN GOODS_IMG.IMG_ID IS '主键';
COMMENT ON COLUMN GOODS_IMG.IMG_SRC IS '图片地址';
COMMENT ON COLUMN GOODS_IMG.GOODS_ID IS '所属商品';
INSERT INTO GOODS_IMG (IMG_ID, IMG_SRC, GOODS_ID) VALUES (1000, 'upload/20180926090823_140634.jpg', 1001);

-- 以下是自增主键序列 请务必执行 当前软件支持 自增主键，当然如果您的数据库不是自增，也没关系，需要您主动在页面维护主键 十分麻烦--
-- DROP SEQUENCE SEQ_SYS_ADMIN_USER;
create sequence SEQ_SYS_ADMIN_USER
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_SYS_GLOBAL_PERMIT_URL;
create sequence SEQ_SYS_GLOBAL_PERMIT_URL
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_SYS_LOG_ADMIN_OPERATE;
create sequence SEQ_SYS_LOG_ADMIN_OPERATE
  minvalue 2000
  maxvalue 9999999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_SYS_MODULE;
create sequence SEQ_SYS_MODULE
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_SYS_MODULE_CATEGORY;
create sequence SEQ_SYS_MODULE_CATEGORY
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_SYS_PERMISSION;
create sequence SEQ_SYS_PERMISSION
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_SYS_ROLE;
create sequence SEQ_SYS_ROLE
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_SYS_ROLE_MODULE_PERMISSION;
create sequence SEQ_SYS_ROLE_MODULE_PERMISSION
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_DICT;
create sequence SEQ_DICT
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_GOODS;
create sequence SEQ_GOODS
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_GOODS_CATEGORY;
create sequence SEQ_GOODS_CATEGORY
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_GOODS_FILE;
create sequence SEQ_GOODS_FILE
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;

-- DROP sequence SEQ_GOODS_IMG;
create sequence SEQ_GOODS_IMG
  minvalue 2000
  maxvalue 999999
  start with 2000
  increment by 1
  nocache;
-- 创建获取序列的函数
create or replace function GET_SEQ_V_A_L_ (seq_name in varchar2) return number
is
  l_res number ;
  begin
    execute immediate 'select '|| seq_name|| '.nextval from dual' into l_res ;
    return l_res ;
  end ;
